<!--
Date: 2025-08-13
Copyright (c) 2025 CAX Conversion Project
-->
<template>
  <el-upload ref="uploadRef" class="upload-demo" v-bind="uploadDefaultProps" :file-list="fileList" :http-request="uploadFileRequest">
    <template #trigger>
      <el-button type="primary">选择文件</el-button>
    </template>
  </el-upload>
</template>

<script setup>
const emit = defineEmits(['uploadFile']);
const { uploadDefaultProps } = defineProps({
  uploadDefaultProps: {
    type: Object,
    default: () => {
      return {
        limit: 1,
        action: '#',
        'auto-upload': false
      };
    }
  },
  uploadFileRequest: {
    type: Function
  },
  fileList: {
    type: Array,
    default: () => {
      return [];
    }
  }
});
const uploadRef = ref(null);
console.log(uploadRef);
// 提供上传文件方法调用
const uploadFile = () => {
  uploadRef.value.submit();
};
emit('uploadFile', uploadFile);
</script>

<style lang="scss" scoped></style>
